package comtacti.native.tests;
import comtacti.native.options.Types;
import utest.Assert;
import comtacti.native.enums.ValuedEnum;

using comtacti.native.enums.ValuedEnum;

class TestManyValuedEnum
{
	public function new():Void
	{
		
	}
	
	public function setup():Void
	{
		
	}
	
	public function test_IntEnum():Void
	{
		Assert.equals(10, ValueTen.toValue());
		Assert.equals(20, ValueTwenty.toValue());
		Assert.equals(0, ValueZero.toValue());
	}
	
	public function test_StringEnum():Void
	{
		Assert.equals("Hello, World!", ValueHelloWorld.toValue());
		Assert.equals("Another Test", ValueAnotherTest.toValue());
		Assert.equals(null, ValueNull.toValue());
	}
	
	public function test_DynamicEnum():Void
	{
		Assert.equals(10, ValueDTen.toValue());
		Assert.equals(3.14, ValueDPI.toValue());
		Assert.equals("Dynamic Test", ValueDTest.toValue());
	}
	
	public function test_ValuedBitEnum():Void
	{
		Assert.equals((1 | (1 << 4)), [BitOne].and(BitFour).toValue());
		Assert.equals((1 | (1 << 3) | (1 << 4)), [BitOne].and(BitFour).and(BitThree).toValue());
	}
}

//@:helper must be the full path to the enum
@:helper(comtacti.native.tests.ValuedManyHelper) 
@:values(Int) private enum ValuedIntEnum
{
	@:value(10) ValueTen;
	@:value(20) ValueTwenty;
	@:value(0) ValueZero;
}

@:helper(comtacti.native.tests.ValuedManyHelper) 
@:values(String) private enum ValuedStringEnum
{
	@:value("Hello, World!") ValueHelloWorld;
	@:value("Another Test") ValueAnotherTest;
	@:value(null) ValueNull;
}

@:helper(comtacti.native.tests.ValuedManyHelper) 
@:values(Dynamic) private enum ValuedDynamicEnum
{
	@:value(10) ValueDTen;
	@:value(3.14) ValueDPI;
	@:value("Dynamic Test") ValueDTest;
}

@:helper(comtacti.native.tests.ValuedManyHelper)
@:values(Bit) private enum ValuedBitEnum
{
	@:value(1) BitOne;
	@:value(1<<2) BitTwo;
	@:value(1<<3) BitThree;
	@:value(1<<4) BitFour;
}

@:subject(ValuedIntEnum)
@:subject(ValuedStringEnum)
@:subject(ValuedDynamicEnum)
@:subject(ValuedBitEnum)
class ValuedManyHelper extends ValuedEnum
{
	
}